package cqut.wys;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;

/**
 * Hello world!
 *
 */
@SpringBootApplication
public class App 
{
    public static void main( String[] args )
    {
        SpringApplication.run(App.class, args);
        System.out.println( "Hello World!" );
    }

    @Bean
    public RouteLocator myRouteLocator(RouteLocatorBuilder builder){
        return builder.routes()
//                .route(r -> r.path("/**").uri("http://localhost:8000"))
                .route(r -> r.path("/taobao")
                        .filters(f -> f.addRequestHeader("Hello","World"))
                .uri("https://www.taobao.com"))
                .build();
    }
}
